import {createSlice} from '@reduxjs/toolkit'


const countSlice = createSlice({
    name:'counter',
    initialState:{
        count:0
    },
    reducers:{
        increment(prevState,action){
            prevState.count += action.payload
        },
        decrement(prevState,action){
            prevState.count -= action.payload
        }
    }
})

//暴露reducer
export default countSlice.reducer
//暴露action
export const {
    increment,
    decrement
} = countSlice.actions